#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
#include "unittests.h"

int run_tests4() {
    struct gameState state;
    memset(&state, 0, sizeof(struct gameState)); // clear the game state
    int kingdom_cards[10] = {adventurer, council_room, feast, gardens, mine,
        remodel, smithy, village, baron, great_hall};

    // reset
    initializeGame(2, kingdom_cards, 1, &state); // initialize a new game

    printf("Testing isGameOver()\n");

    // New game shouldn't be over
    assert(isGameOver(&state) == 0);
    printf("isGameOver with new game passed");

    // No more provinces should end game
    state.supplyCount[province] = 0;
    assert(isGameOver(&state) == 1);

    printf("isGameOver with no more provinces passed\n");

    // reset
    initializeGame(2, kingdom_cards, 1, &state); // initialize a new game

    state.supplyCount[council_room] = 0;
    state.supplyCount[feast] = 0;
    state.supplyCount[gardens] = 0;

    // if 3 supply piles are emptied the game also ends
    assert(isGameOver(&state) == 1);

    printf("isGameOver with 3 empty supplies passed\n");

    printf("\n");

    return 0;
}